package com.huage_05.lesson_04;

import java.util.Calendar;
import java.util.Scanner;

/*
    获取任意年二月有多少天
 */
public class CalenderTest {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入要查询的年份:");
        int year = sc.nextInt();

        Calendar c = Calendar.getInstance();
        c.set(year,2,1);
        c.add(Calendar.DATE,-1);
        System.out.println(year+"年的二月份有"+c.get(Calendar.DATE)+"天");
    }
}
